package com.ziq.base.utils

import android.content.Context
import java.io.File

class StorageUtil {
    companion object {
        @JvmStatic
        fun getCacheFile(context: Context, fileName:String): File? {
            val path = context.cacheDir.absolutePath + File.separator + fileName
            try {
                val file = File(path)
                if(!file.exists()){
                    if(file.parentFile != null && !file.parentFile!!.exists()){
                        file.parentFile!!.mkdirs()
                    }
                    file.createNewFile()
                }
                return file
            } catch (e:Exception){
                e.printStackTrace()
                return null
            }
        }
    }
}